<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>{$meta_title}-狂雨小说CMS</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
        <link rel="stylesheet" href="__ADMIN__/css/font.css">
        <link rel="stylesheet" href="__ADMIN__/css/admin.css">
        <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js"></script>
    </head>
    <body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
	            <div class="layui-card">
	                <div class="layui-tab layui-tab-brief">
	               		{if array_key_exists($id,$Think.config.web.config_group_list)}
						<ul class="layui-tab-title">
							{volist name="Think.config.web.config_group_list" id="group"}
						    	<li {eq name="id" value="$key"}class="layui-this"{/eq}><a href="{:url('?id='.$key)}">{$group}配置</a></li>
						    {/volist}
						</ul>
						{/if}
						<div class="layui-tab-content">
						    <div class="layui-card-body">
					            <form action="{:url('save')}" class="layui-form" method="post">
					            	{volist name="list" id="config"}
								        <div class="layui-form-item">
								            <label class="layui-form-label">{$config.title}</label>
											{switch name="config.type"}
												{case value="0"}
									                <div class="layui-input-inline">
									                	<input type="text" name="config[{$config.name}]" value="{$config.value}" class="layui-input">
									                </div>
									                {notempty name="config.remark"}
									                	<div class="layui-form-mid layui-word-aux">{$config.remark}</div>
									                {/notempty}
									            {/case}
									            {case value="1"}
									              	<div class="layui-input-block">
									              		<input type="text" name="config[{$config.name}]" value="{$config.value}" class="layui-input">
									              		{notempty name="config.remark"}
									              			<div class="layui-form-mid layui-word-aux">{$config.remark}</div>
									              		{/notempty}
									              	</div>
												{/case}
												{case value="2"}
													<div class="layui-input-block">
									              		<textarea name="config[{$config.name}]" class="layui-textarea" placeholder="{$config.remark}">{$config.value}</textarea>
									              		{notempty name="config.remark"}
									              			<div class="layui-form-mid layui-word-aux">{$config.remark}</div>
									              		{/notempty}
									              	</div>
												{/case}
												{case value="3"}
													<div class="layui-input-block">
									              		<textarea name="config[{$config.name}]" class="layui-textarea" placeholder="{$config.remark}">{$config.value}</textarea>
									              		{notempty name="config.remark"}
									              			<div class="layui-form-mid layui-word-aux">{$config.remark}</div>
									              		{/notempty}
									              	</div>
												{/case}
												{case value="4"}
													<div class="layui-input-block">
														{volist name=":parse_config_attr($config['extra'])" id="vo"}
	      													<input type="radio" name="config[{$config.name}]" value="{$key}" title="{$vo}" {eq name="config.value" value="$key"}checked{/eq}>
      													{/volist}
													</div>
													{notempty name="config.remark"}
								              			<div class="layui-form-mid layui-word-aux">{$config.remark}</div>
								              		{/notempty}
												{/case}
												{case value="5"}
													<div class="layui-input-block">
						                                {volist name=":parse_config_attr($config['extra'])" id="vo"}
						                                    <input name="config[{$config.name}][]" type="checkbox" lay-skin="primary" value="{$key}" title="{$vo}" {in name="key" value="$config['value']"}checked="checked"{/in}>
						                                {/volist}
					                            	</div>
					                            	{notempty name="config.remark"}
								              			<div class="layui-form-mid layui-word-aux">{$config.remark}</div>
								              		{/notempty}
					                            {/case}
												{case value="6"}
													<div class="layui-input-inline">
														<select name="config[{$config.name}]">
															{volist name=":parse_config_attr($config['extra'])" id="vo"}
																<option value="{$key}" {eq name="config.value" value="$key"}selected{/eq}>{$vo}</option>
															{/volist}
														</select>
													</div>
													{notempty name="config.remark"}
								              			<div class="layui-form-mid layui-word-aux">{$config.remark}</div>
								              		{/notempty}
												{/case}
												{case value="7"}
													<div class="layui-input-block">
														<div class="input-group">
															<input type="text" size="60" name="config[{$config.name}]" value="{$config.value}" class="layui-input">
															<button class="layui-btn" id="{$config.name}_upload" type="button">上传图片</button>
														</div>
													</div>
													{notempty name="config.remark"}
								              			<div class="layui-form-mid layui-word-aux">{$config.remark}</div>
								              		{/notempty}
								              		<script>
														layui.use(['layer','upload','jquery'], function(){
														  var layer = layui.layer;
														  var upload = layui.upload;
														  var uploadInst = upload.render({
														    elem: '#{$config.name}_upload' //绑定元素
														    ,url: '{:url('upload/pic')}' //上传接口
														    ,data: {path:'config'}
														    ,done: function(data){
														      if(data.code){
														      	layer.msg(data.msg, {icon: 1,shade: 0.3,time: 2000},function(layero, index){
											        					$('[name="config[{$config.name}]"]').val(data.data.path);
											    					});			      	
														      }else{
														      	layer.msg(data.msg, {icon: 0,shade: 0.3});
														      }
														    }
														    ,error: function(){
														      //请求异常回调
														    }
														  });
														});
													</script>
												{/case}
											{/switch}
								        </div>
						            {/volist}
						            <div class="layui-form-item">
						                <div class="layui-input-block">
						                  	<button class="layui-btn" lay-submit lay-filter="ajax" lay-current="1">确认保存</button>
						                </div>
					              	</div>
					            </form>
					       	</div>
						</div>
					</div>
				</div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="__STATIC__/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/admin.js"></script>
    </body>
</html>